Today, most of the businesses are supported by business applications, which act as the primary means of conducting business. The business applications help enterprises focus on their core business activities by integrating work processes seamlessly to speed up business processes and to improve workflow effectively. Further, these business applications when applied across various industries/enterprises have been helpful in meeting the needs of contemporary business requirements. Thus, in the fast changing business world, such applications have gained tremendous importance and popularity over the recent years.
Business applications can be developed in various programming languages as per requirements and ease of use. Examples of some popular programming languages are C, C# (ASP.Net), C++, Visual Basic (VB), VB.Net, Visual FoxPro, Pearl, Java, and JavaScript. Generally, application developers prefer object-oriented language, such as Java, because of its various features such as simplicity, modularity, and re-usability. Additional features supported by Java are distributed, interpreted, robust, secure, portable, automatic garbage collection, ease-of-use, and multi-threaded. Java also enables the application developers to develop applications on the Internet for servers, desktops computers, and small hand-held devices.
To develop any business application in Java, one or more classes and corresponding objects are created. The process of development further involves creation of threads within the business application; wherein the threads enhance the performance of Java platform. Once the business application is developed, it is executed by Java Run-Time Environment (JRE) or Java Virtual Machine (JVM). The execution of business application involves the allocation of various resources for example, memory, files, and connections to the business application. While executing the business application, the problems faced by the application developers many a times relates to resource over-allocation. Various examples of the resource over-allocation are memory over-allocation, file exhaustion, and connection over runs. Of these, memory over-allocation is the most common problem faced by the application developers. Memory over-allocation defines that the memory utilized by the business application has exceeded the value as pre-set for the business application. In general, memory over-allocation occurs when Java platform runs out of memory because of the non-availability of continuous memory or the memory is not getting de-allocated. When such situations occur, Java platform has no other option but to abort and this sometimes leads to failure/crashing of Java platform. This subsequently leads to the denial of service for multiple applications running on Java platform.
To counter memory over-allocation scenarios, Java facilitates garbage collection. The purpose of garbage collection is to find objects that are no longer required by an application and to remove the objects when they are no longer accessed or referenced. In other words, garbage collection is used to clear the unused memory by aging out unreferenced objects. In this manner, garbage collection reclaims the memory space when no longer needed, and thus helps in preventing the memory over-allocation. However, there are a lot of disadvantages associated with this approach. One of the disadvantages is that garbage collector is unaware of each thread/function holding object references. Pursuant to this, this approach fails to detect a particular function/thread responsible for memory over-allocation. Further, there is no mechanism provided by this approach to stop the execution of a thread/a function that has run into a situation of memory over-allocation. As a result, one runaway thread/function uses the entire memory space, thereby causing memory starvation for other threads/functions which in turn leads to halting of Java platform. Moreover, the current approach of garbage collection does not provide an opportunity to the application developers to define an upper limit of memory usage for each function/thread defined in the business application.
Many more solutions are available in the market for detecting memory over-allocation. One of such solutions focuses on increasing the size of memory when such scenario occurs. However, the existing solution becomes an effort intensive task as the application developers need to modify the business application to increase the size of allocated memory as per the requirement. Further, there is no mechanism provided by these solutions for detecting file exhaustion and connection over runs. Moreover, these existing solutions fail to determine possible measures that need to be taken when such scenarios/situations occur. Additionally, the existing solutions do not proactively anticipate the occurrence of such situations. Instead, these solutions focus on waiting till the time Java platform encounters these situations.
In view of the aforesaid discussion, there is a need for a method and a system to prevent a run-time platform running into such situations by proactively detecting faulty conditions in a business application. The proactive detection of the faulty conditions prevents the run-time platform suffering from such conditions. Further, there lies a need for taking appropriate measures when such conditions are detected; which in turn prevents the platform from failure/crashing. Furthermore, there also lies a need for a generic approach facilitating determination of the faulty conditions with respect to all types of resources allocated to the business application. Moreover, there exists a need to identify a function or a thread responsible for the occurrence of the faulty conditions. The method and the system should also be able to stop the execution of the function or the thread responsible for the faulty conditions and should continuously monitor resources allocated to the business application.